package main

import (
	"strconv"
)

func getHint(secret string, guess string) string {
	bulls := 0
	secretMap := make(map[byte]int)
	guessMap := make(map[byte]int)
	for i := range secret {
		sc := secret[i]
		gc := guess[i]
		if sc == gc {
			bulls++
		} else {
			secretMap[sc]++
			guessMap[gc]++
		}
	}
	cow := 0
	for sc2, scount := range secretMap {
		gcount := guessMap[sc2]
		if scount < gcount {
			cow += scount
		} else {
			cow += gcount
		}
	}
	return strconv.Itoa(bulls) + "A" + strconv.Itoa(cow) + "B"
}

func main() {
	println(getHint("1123", "0111"))
}
